package com.hhs.storage.controller;


import com.hhs.storage.bean.InputParam;
import com.hhs.storage.bean.Suggestion;
import com.hhs.storage.service.SuggestionService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hhs
 * @since 2023-04-22
 */
@RestController
@RequestMapping("/suggestion")
public class SuggestionController {
    @Resource
    private SuggestionService suggestionService;

    /**
     *
     * @param suggestion
     * @param inputParam page size 分页
     * @param inputParam mainId 要查询的部门id
     * @param inputParam createTimeStartTime createTimeEndTime 根据创建时间的开始日期，结束日期查询
     * @return
     */
    @RequestMapping(value = "table")
    public Map<String, Object> getAll(Suggestion suggestion, InputParam inputParam) {
        return suggestionService.getAll(suggestion,inputParam);
    }

    @PostMapping(value = "edit")
    public Map<String, Object> addOrUpdate(Suggestion suggestion){
        return suggestionService.addOrUpdate(suggestion);
    }
    @RequestMapping(value = "dele")
    public Map<String, Object> dele(@RequestParam String id) {
        return suggestionService.dele(id);
    }
}

